feat(mdx/image): Add dead image detection#3275
Merged
SoonIter merged 2 commits intoweb-infra-dev:mainfrom Apr 7, 2026
Merged
Conversation
I noticed during builds that if dead image links were used that they did not necessarily produce a warning. But dead links would. This copies the pattern used for dead link detection and basically applies it to images as well. But does not do anything for external images, only local ones.
Contributor
Author
|
Still need to update documentation, working on that now |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds dead local image detection to the MDX pipeline, mirroring the existing dead link detection behavior, with configurable options exposed via markdown.image.
Changes:
- Introduces
RemarkImageOptions(checkDeadImageswith optional excludes) and wires it intoMarkdownOptions. - Extends the
remarkImageplugin to detect missing local images (absolute-from-public and relative-to-doc) and fail builds in production (or report via lint). - Adds unit tests covering existing/missing absolute & relative images and external image behavior; plumbs the new options through MDX options creation (disabled for
isSsgMd).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/shared/src/types/index.ts | Adds RemarkImageOptions and exposes markdown.image config. |
| packages/core/src/node/mdx/remarkPlugins/image.ts | Implements dead local image detection and reporting/throwing logic. |
| packages/core/src/node/mdx/remarkPlugins/image.test.ts | Adds tests for dead-image detection behavior. |
| packages/core/src/node/mdx/options.ts | Passes docDirectory + markdown.image options into remarkImage (disabled for SSG-md). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
I've updated part of the docs, but only the english version |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I noticed during builds that if dead image links were used that they did not necessarily produce a warning. But dead links would. This copies the pattern used for dead link detection and basically applies it to images as well. But does not do anything for external images, only local ones.
Related Issue
N/A
Checklist